{template 'public/header'}
{template 'public/comhead'}
<link rel="stylesheet" type="text/css" href="../addons/hyb_o2o/template/public/ygcss.css">
<style type="text/css">
    .yg5_key>div{float: left;line-height: 34px;}

    .store_td1{height: 45px;}

    .store_list_img{width: 60px;height: 60px;}

    .yg5_tabel{border-color: #e5e5e5;outline: 1px solid #e5e5e5;text-align: center;}

    .yg5_tr2>td{padding: 15px;border: 1px solid #e5e5e5;}

    .yg5_tr1>td{

        border: 1px solid #e5e5e5;
        background-color: #FAFAFA;
        padding: 8px;
        font-weight: bold;

    }
    
    .yg5_btn{background-color: #EEEEEE;color: #333;border: 1px solid #E4E4E4;border-radius: 6px;width: 100px;height: 34px;}
    .check_img{width: 45px;height: 45px;}
    .ygrow{margin-top: 20px;}
    .yghuise{background-color: grey;color: white;}
    .yghuise:hover{background-color: grey;color: white;}
</style>
<ul class="nav nav-tabs">
    <span class="ygxian"></span>
    <div class="ygdangq">当前位置:</div>    
    <li {if $op == 'display'} class="active" {/if}><a href="{php echo $this->createWebUrl('fuwutype',array('op'=>'display'))}">一级分类</a></li>
    <li {if $op == 'post'} class="active" {/if}><a href="{php echo $this->createWebUrl('fuwutype',array('op'=>'post'))}">添加一级分类</a></li>
    <li {if $op == 'displays'} class="active" {/if}><a href="{php echo $this->createWebUrl('fuwutype',array('op'=>'displays'))}">二级分类</a></li>
    <li {if $op == 'posts'} class="active" {/if}><a href="{php echo $this->createWebUrl('fuwutype',array('op'=>'posts'))}">添加二级分类</a></li>
</ul>
{if $op =="display"}
<div class="panel panel-default" style="margin-top: 20px;">
    <div class="panel-heading"></div>
        <div class="panel-body" style="padding: 0px 15px;">
            <div class="row">
            <table class="yg5_tabel col-md-12">
                        <tbody><tr class="yg5_tr1">
                            <td class="store_td1 col-md-1">顺序</td>
                            <td class="col-md-2">图标</td>
                            <td class="col-md-2">分类名称</td>
                             <td class="col-md-2">平台抽水</td>
                              <td class="col-md-2">是否推荐</td>
                            <td class="col-md-3">操作</td>
                        </tr>  {loop $products $item}
                        <tr class="yg5_tr2">
                            <td><div>{$item['xt_ids']}</div></td>
                            <td>
                                <img class="store_list_img" src="{media $item['xt_thumb']}" alt="">                                
                            </td>
                            <td>{$item['xt_name']}</td>
                           
                            <td>{php echo $item['choushui']*100}%</td>
                            <td> 
                            {if $item['xt_tuijian'] == "1"}
                                <span class="label storered">是</span>
                            {else}
                                <span class="label storered">否</span>
                            {/if}
                            </td>
                        <td>
                            <a href="{php echo $this->createWeburl('fuwutype', array('xt_id' => $item['xt_id'], 'op' =>'post'))}"  class="storespan btn btn-xs">
                                <span class="fa fa-pencil"></span>
                                <span class="bianji">编辑
                                    <span class="arrowdown"></span>
                                </span>
                            </a>
                            <a href="{php echo $this->createWeburl('fuwutype', array('xt_id' => $item['xt_id'],'typs'=>'yiji', 'op' => 'delete'))}" class="storespan btn btn-xs">
                                <span class="fa fa-trash-o"></span>
                                <span class="bianji">删除
                                    <span class="arrowdown"></span>
                                </span>
                            </a>
                        </td>
                    </tr>
                    {/loop}
                  
                </table>
                <div class="text-right we7-margin-top">
     {$pager}
</div>
            </div>
        </div>
    </div>
</div>
{/if}
{if $op == "post"}
<div class="main">
    <form action="" method="post" class="form-horizontal form" enctype="multipart/form-data">
        <div class="panel panel-default ygdefault">
            <div class="panel-heading wyheader">
                添加一级分类
            </div>
            <div class="form-group" style="margin-top: 20px;">
                <label class="col-xs-12 col-sm-3 col-md-2 control-label">排序</label>
                <div class="col-sm-9">
                    <input type="number" name="xt_ids" class="form-control" value="{$items['xt_ids']}" placeholder="数字越大排序越靠前" />
                </div>
            </div>
            <div class="form-group">
                <label class="col-xs-12 col-sm-3 col-md-2 control-label">分类名称</label>
                <div class="col-sm-9">
                    <input type="text" name="xt_name" value="{$items['xt_name']}" class="form-control" placeholder="请服务名称" />
                </div>
            </div>
            <div class="form-group">
                <label class="col-xs-12 col-sm-3 col-md-2 control-label">分类logo</label>
                <div class="col-sm-9">
                    {php echo tpl_form_field_image('xt_thumb', $items['xt_thumb'])}
                </div>
            </div>
            <div class="form-group">
                <label class="col-xs-12 col-sm-3 col-md-2 control-label">抽水比例</label>
                <div class="col-sm-9">
                    <input type="text" name="choushui" value="{$items['choushui']}" class="form-control" placeholder="请输入小数" />
                </div>
            </div>
            <div class="form-group">
                <label class="col-xs-12 col-sm-3 col-md-2 control-label">是否推荐</label>

                <div class="col-sm-9">
                    <input type="radio" name="xt_tuijian"  value="1" {if $items['xt_tuijian'] == '1'} checked {/if} />是
                    <input type="radio" name="xt_tuijian"  value="0" {if $items['xt_tuijian'] == '0'} checked {/if} />否
                </div>
            </div>
            <div class="form-group">
                <label class="col-xs-12 col-sm-3 col-md-2 control-label">推荐是否跳转发布</label>

                <div class="col-sm-9">
                    <input type="radio" name="xt_tuijian_fabu"  value="1" {if $items['xt_tuijian_fabu'] == '1'} checked {/if} />是
                    <input type="radio" name="xt_tuijian_fabu"  value="0" {if $items['xt_tuijian_fabu'] == '0'} checked {/if} />否
                </div>
            </div>
            
            <div class="form-group" id="tzdiv">
                <label class="col-xs-12 col-sm-3 col-md-2 control-label"></label>
                <div class="col-sm-9">
                    <select class="form-control" name="xt_tzej">
                        <option>---请选择---</option>
                        {loop $typs $ty}
                        <option value="{$ty['xt_id']}" {if $items['xt_tzej']==$ty['xt_id']} selected {/if}>{$ty['xt_name']}</option>
                        {/loop}
                    </select>
                </div>
            </div>
        <div class="form-group" style="margin-top: 20px;">
            <input type="submit" name="submit" value="提交" class="btn col-lg-3" style="color: white;background-color: #44ABF7;"/>
            <input type="hidden" name="token" value="{$_W['token']}" />
        </div>
    </form>
</div>
{/if}
{if $op == "displays"}
<div class="panel panel-default" style="margin-top: 20px;">
    <div class="panel-heading"></div>
        <div class="panel-body" style="padding: 0px 15px;">
            <div class="row">
                <table class="yg5_tabel col-md-12">
                    <tr class="yg5_tr1">
                        <td>排序</td>
                        <td>服务分类名称</td>
                        <td>服务分类图标</td>
                        <td>父级分类名称</td>
                        <td >操作</td>
                    </tr>
                    {loop $products $item}
                    <tr class="yg5_tr2">
                        <td>
                            {$item['xt_ids']}
                        </td>
                        <td>
                            {$item['xt_name']}
                        </td>
                        <td>
                            <img src="{media $item['xt_thumb']}" style="width: 80px;height: 80px;" alt="">
                        </td>
                        <td>
                            {$item['parent']['xt_name']}
                        </td>
                        <td>
                                <a href="{php echo $this->createWeburl('fuwutype', array('xt_id' => $item['xt_id'], 'op' =>'posts'))}" class="storespan btn btn-xs">
                                    <span class="fa fa-pencil"></span>
                                    <span class="bianji">编辑
                                        <span class="arrowdown"></span>
                                    </span>
                                </a>
                                <a  href="{php echo $this->createWeburl('fuwutype', array('xt_id' => $item['xt_id'],'typs'=>'erji', 'op' => 'delete'))}" class="storespan btn btn-xs">
                                    <span class="fa fa-trash-o"></span>
                                    <span class="bianji">删除
                                        <span class="arrowdown"></span>
                                    </span>
                                </a>
                            </td>
                    </tr>
                    {/loop}

                </table>
            </div>
        </div>
    </div>
</div>
<div class="text-right we7-margin-top">
     {$pager}
</div>
{/if}
{if $op == "posts"}
<div class="main">
    <form action="" method="post" class="form-horizontal form" enctype="multipart/form-data">
        <div class="panel panel-default ygdefault">
            <div class="panel-heading wyheader">
                添加二级分类
            </div>
            <div class="form-group" style="margin-top: 20px;">
                <label class="col-xs-12 col-sm-3 col-md-2 control-label">排序</label>
                <div class="col-sm-9">
                    <input type="number" name="xt_ids" class="form-control" value="{$items['xt_ids']}" placeholder="数字越大排序越靠前" />
                </div>
            </div>
            <div class="form-group">
                <label class="col-xs-12 col-sm-3 col-md-2 control-label">分类名称</label>
                <div class="col-sm-9">
                    <input type="text" name="xt_name" value="{$items['xt_name']}" class="form-control" placeholder="请输入服务名称" />
                </div>
            </div>
            <div class="form-group">
                <label class="col-xs-12 col-sm-3 col-md-2 control-label">分类logo</label>
                <div class="col-sm-9">
                    {php echo tpl_form_field_image('xt_thumb', $items['xt_thumb'])}
                </div>
            </div>
            <div class="form-group">
                <label class="col-xs-12 col-sm-3 col-md-2 control-label">平台参考价</label>
                <div class="col-sm-9">
                    <input type="text" name="xt_reference_price" value="{$items['xt_reference_price']}" class="form-control" placeholder="请输入平台参考价" />
                </div>
            </div>
            <div class="form-group">
                <label class="col-xs-12 col-sm-3 col-md-2 control-label">请填写上门费用</label>
                <div class="col-sm-9">
                    <input type="text" name="xt_smreference_price" value="{$items['xt_smreference_price']}" class="form-control" placeholder="请输入上门费用" />
                </div>
            </div>
            <div class="form-group">
                <label class="col-xs-12 col-sm-3 col-md-2 control-label">所属一级分类</label>
                <div class="col-sm-9">
                    <select name="xt_parentid"  class="form-control">
                        <option value="">--请选择--</option>
                        {loop $fuji $item}
                            <option value="{$item['xt_id']}" {if $item['xt_id']==$items['xt_parentid']}selected{/if} >{$item['xt_name']}</option>
                        {/loop}
                    </select>
                </div>
            </div>
        <div class="form-group" style="margin-top: 20px;">
            <input type="submit" name="submit" value="提交" class="btn col-lg-3" style="color: white;background-color: #44ABF7;"/>
            <input type="hidden" name="token" value="{$_W['token']}" />
        </div>
    </form>
</div>
{/if}
<script type="text/javascript">
    $(function(){
        $("#frame-2").show();
        $("#yframe-2").addClass("wyactive");
        {if $items['xt_tuijian_fabu'] == '1'}
            $("#tzdiv").show();
        {else}
            $("#tzdiv").hide();
        {/if}
        $("input[name='xt_tuijian_fabu']").click(function(){
            if($(this).val() == 1){
                $("#tzdiv").show();
            }else{
                $("#tzdiv").hide();
            }
        });
    })
</script>
{template "common/footer"}